#include "live.h"

namespace {
#define DIM 22
#define EDIM 21
#define MEDIM 21
typedef void (*Hfun)(double *, double *, double *);
const static double MAHA_THRESH_4 = 7.814727903251177;
const static double MAHA_THRESH_9 = 7.814727903251177;
const static double MAHA_THRESH_10 = 7.814727903251177;
const static double MAHA_THRESH_12 = 7.814727903251177;
const static double MAHA_THRESH_35 = 7.814727903251177;
const static double MAHA_THRESH_32 = 9.487729036781154;
const static double MAHA_THRESH_13 = 7.814727903251177;
const static double MAHA_THRESH_14 = 7.814727903251177;
const static double MAHA_THRESH_33 = 7.814727903251177;

/******************************************************************************
 *                       Code generated with SymPy 1.12                       *
 *                                                                            *
 *              See http://www.sympy.org/ for more information.               *
 *                                                                            *
 *                         This file is part of 'ekf'                         *
 ******************************************************************************/
void H(double *in_vec, double *out_7176771882123068031) {
   out_7176771882123068031[0] = 0;
   out_7176771882123068031[1] = -sin(in_vec[1])*sin(in_vec[2])*in_vec[4] - sin(in_vec[1])*cos(in_vec[2])*in_vec[3] - cos(in_vec[1])*in_vec[5];
   out_7176771882123068031[2] = -sin(in_vec[2])*cos(in_vec[1])*in_vec[3] + cos(in_vec[1])*cos(in_vec[2])*in_vec[4];
   out_7176771882123068031[3] = cos(in_vec[1])*cos(in_vec[2]);
   out_7176771882123068031[4] = sin(in_vec[2])*cos(in_vec[1]);
   out_7176771882123068031[5] = -sin(in_vec[1]);
   out_7176771882123068031[6] = (sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]))*in_vec[3] + (-sin(in_vec[0])*cos(in_vec[2]) + sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]))*in_vec[4] + cos(in_vec[0])*cos(in_vec[1])*in_vec[5];
   out_7176771882123068031[7] = -sin(in_vec[0])*sin(in_vec[1])*in_vec[5] + sin(in_vec[0])*sin(in_vec[2])*cos(in_vec[1])*in_vec[4] + sin(in_vec[0])*cos(in_vec[1])*cos(in_vec[2])*in_vec[3];
   out_7176771882123068031[8] = (-sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) - cos(in_vec[0])*cos(in_vec[2]))*in_vec[3] + (sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) - sin(in_vec[2])*cos(in_vec[0]))*in_vec[4];
   out_7176771882123068031[9] = sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) - sin(in_vec[2])*cos(in_vec[0]);
   out_7176771882123068031[10] = sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) + cos(in_vec[0])*cos(in_vec[2]);
   out_7176771882123068031[11] = sin(in_vec[0])*cos(in_vec[1]);
   out_7176771882123068031[12] = (-sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) - cos(in_vec[0])*cos(in_vec[2]))*in_vec[4] + (-sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) + sin(in_vec[2])*cos(in_vec[0]))*in_vec[3] - sin(in_vec[0])*cos(in_vec[1])*in_vec[5];
   out_7176771882123068031[13] = -sin(in_vec[1])*cos(in_vec[0])*in_vec[5] + sin(in_vec[2])*cos(in_vec[0])*cos(in_vec[1])*in_vec[4] + cos(in_vec[0])*cos(in_vec[1])*cos(in_vec[2])*in_vec[3];
   out_7176771882123068031[14] = (sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]))*in_vec[4] + (sin(in_vec[0])*cos(in_vec[2]) - sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]))*in_vec[3];
   out_7176771882123068031[15] = sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]);
   out_7176771882123068031[16] = -sin(in_vec[0])*cos(in_vec[2]) + sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]);
   out_7176771882123068031[17] = cos(in_vec[0])*cos(in_vec[1]);
}
void err_fun(double *nom_x, double *delta_x, double *out_7383003451745682886) {
   out_7383003451745682886[0] = delta_x[0] + nom_x[0];
   out_7383003451745682886[1] = delta_x[1] + nom_x[1];
   out_7383003451745682886[2] = delta_x[2] + nom_x[2];
   out_7383003451745682886[3] = -0.5*delta_x[3]*nom_x[4] - 0.5*delta_x[4]*nom_x[5] - 0.5*delta_x[5]*nom_x[6] + 1.0*nom_x[3];
   out_7383003451745682886[4] = 0.5*delta_x[3]*nom_x[3] + 0.5*delta_x[4]*nom_x[6] - 0.5*delta_x[5]*nom_x[5] + 1.0*nom_x[4];
   out_7383003451745682886[5] = -0.5*delta_x[3]*nom_x[6] + 0.5*delta_x[4]*nom_x[3] + 0.5*delta_x[5]*nom_x[4] + 1.0*nom_x[5];
   out_7383003451745682886[6] = 0.5*delta_x[3]*nom_x[5] - 0.5*delta_x[4]*nom_x[4] + 0.5*delta_x[5]*nom_x[3] + 1.0*nom_x[6];
   out_7383003451745682886[7] = delta_x[6] + nom_x[7];
   out_7383003451745682886[8] = delta_x[7] + nom_x[8];
   out_7383003451745682886[9] = delta_x[8] + nom_x[9];
   out_7383003451745682886[10] = delta_x[9] + nom_x[10];
   out_7383003451745682886[11] = delta_x[10] + nom_x[11];
   out_7383003451745682886[12] = delta_x[11] + nom_x[12];
   out_7383003451745682886[13] = delta_x[12] + nom_x[13];
   out_7383003451745682886[14] = delta_x[13] + nom_x[14];
   out_7383003451745682886[15] = delta_x[14] + nom_x[15];
   out_7383003451745682886[16] = delta_x[15] + nom_x[16];
   out_7383003451745682886[17] = delta_x[16] + nom_x[17];
   out_7383003451745682886[18] = delta_x[17] + nom_x[18];
   out_7383003451745682886[19] = delta_x[18] + nom_x[19];
   out_7383003451745682886[20] = delta_x[19] + nom_x[20];
   out_7383003451745682886[21] = delta_x[20] + nom_x[21];
}
void inv_err_fun(double *nom_x, double *true_x, double *out_8043250382326694273) {
   out_8043250382326694273[0] = -nom_x[0] + true_x[0];
   out_8043250382326694273[1] = -nom_x[1] + true_x[1];
   out_8043250382326694273[2] = -nom_x[2] + true_x[2];
   out_8043250382326694273[3] = 2*nom_x[3]*true_x[4] - 2*nom_x[4]*true_x[3] + 2*nom_x[5]*true_x[6] - 2*nom_x[6]*true_x[5];
   out_8043250382326694273[4] = 2*nom_x[3]*true_x[5] - 2*nom_x[4]*true_x[6] - 2*nom_x[5]*true_x[3] + 2*nom_x[6]*true_x[4];
   out_8043250382326694273[5] = 2*nom_x[3]*true_x[6] + 2*nom_x[4]*true_x[5] - 2*nom_x[5]*true_x[4] - 2*nom_x[6]*true_x[3];
   out_8043250382326694273[6] = -nom_x[7] + true_x[7];
   out_8043250382326694273[7] = -nom_x[8] + true_x[8];
   out_8043250382326694273[8] = -nom_x[9] + true_x[9];
   out_8043250382326694273[9] = -nom_x[10] + true_x[10];
   out_8043250382326694273[10] = -nom_x[11] + true_x[11];
   out_8043250382326694273[11] = -nom_x[12] + true_x[12];
   out_8043250382326694273[12] = -nom_x[13] + true_x[13];
   out_8043250382326694273[13] = -nom_x[14] + true_x[14];
   out_8043250382326694273[14] = -nom_x[15] + true_x[15];
   out_8043250382326694273[15] = -nom_x[16] + true_x[16];
   out_8043250382326694273[16] = -nom_x[17] + true_x[17];
   out_8043250382326694273[17] = -nom_x[18] + true_x[18];
   out_8043250382326694273[18] = -nom_x[19] + true_x[19];
   out_8043250382326694273[19] = -nom_x[20] + true_x[20];
   out_8043250382326694273[20] = -nom_x[21] + true_x[21];
}
void H_mod_fun(double *state, double *out_3022064996999117402) {
   out_3022064996999117402[0] = 1.0;
   out_3022064996999117402[1] = 0;
   out_3022064996999117402[2] = 0;
   out_3022064996999117402[3] = 0;
   out_3022064996999117402[4] = 0;
   out_3022064996999117402[5] = 0;
   out_3022064996999117402[6] = 0;
   out_3022064996999117402[7] = 0;
   out_3022064996999117402[8] = 0;
   out_3022064996999117402[9] = 0;
   out_3022064996999117402[10] = 0;
   out_3022064996999117402[11] = 0;
   out_3022064996999117402[12] = 0;
   out_3022064996999117402[13] = 0;
   out_3022064996999117402[14] = 0;
   out_3022064996999117402[15] = 0;
   out_3022064996999117402[16] = 0;
   out_3022064996999117402[17] = 0;
   out_3022064996999117402[18] = 0;
   out_3022064996999117402[19] = 0;
   out_3022064996999117402[20] = 0;
   out_3022064996999117402[21] = 0;
   out_3022064996999117402[22] = 1.0;
   out_3022064996999117402[23] = 0;
   out_3022064996999117402[24] = 0;
   out_3022064996999117402[25] = 0;
   out_3022064996999117402[26] = 0;
   out_3022064996999117402[27] = 0;
   out_3022064996999117402[28] = 0;
   out_3022064996999117402[29] = 0;
   out_3022064996999117402[30] = 0;
   out_3022064996999117402[31] = 0;
   out_3022064996999117402[32] = 0;
   out_3022064996999117402[33] = 0;
   out_3022064996999117402[34] = 0;
   out_3022064996999117402[35] = 0;
   out_3022064996999117402[36] = 0;
   out_3022064996999117402[37] = 0;
   out_3022064996999117402[38] = 0;
   out_3022064996999117402[39] = 0;
   out_3022064996999117402[40] = 0;
   out_3022064996999117402[41] = 0;
   out_3022064996999117402[42] = 0;
   out_3022064996999117402[43] = 0;
   out_3022064996999117402[44] = 1.0;
   out_3022064996999117402[45] = 0;
   out_3022064996999117402[46] = 0;
   out_3022064996999117402[47] = 0;
   out_3022064996999117402[48] = 0;
   out_3022064996999117402[49] = 0;
   out_3022064996999117402[50] = 0;
   out_3022064996999117402[51] = 0;
   out_3022064996999117402[52] = 0;
   out_3022064996999117402[53] = 0;
   out_3022064996999117402[54] = 0;
   out_3022064996999117402[55] = 0;
   out_3022064996999117402[56] = 0;
   out_3022064996999117402[57] = 0;
   out_3022064996999117402[58] = 0;
   out_3022064996999117402[59] = 0;
   out_3022064996999117402[60] = 0;
   out_3022064996999117402[61] = 0;
   out_3022064996999117402[62] = 0;
   out_3022064996999117402[63] = 0;
   out_3022064996999117402[64] = 0;
   out_3022064996999117402[65] = 0;
   out_3022064996999117402[66] = -0.5*state[4];
   out_3022064996999117402[67] = -0.5*state[5];
   out_3022064996999117402[68] = -0.5*state[6];
   out_3022064996999117402[69] = 0;
   out_3022064996999117402[70] = 0;
   out_3022064996999117402[71] = 0;
   out_3022064996999117402[72] = 0;
   out_3022064996999117402[73] = 0;
   out_3022064996999117402[74] = 0;
   out_3022064996999117402[75] = 0;
   out_3022064996999117402[76] = 0;
   out_3022064996999117402[77] = 0;
   out_3022064996999117402[78] = 0;
   out_3022064996999117402[79] = 0;
   out_3022064996999117402[80] = 0;
   out_3022064996999117402[81] = 0;
   out_3022064996999117402[82] = 0;
   out_3022064996999117402[83] = 0;
   out_3022064996999117402[84] = 0;
   out_3022064996999117402[85] = 0;
   out_3022064996999117402[86] = 0;
   out_3022064996999117402[87] = 0.5*state[3];
   out_3022064996999117402[88] = 0.5*state[6];
   out_3022064996999117402[89] = -0.5*state[5];
   out_3022064996999117402[90] = 0;
   out_3022064996999117402[91] = 0;
   out_3022064996999117402[92] = 0;
   out_3022064996999117402[93] = 0;
   out_3022064996999117402[94] = 0;
   out_3022064996999117402[95] = 0;
   out_3022064996999117402[96] = 0;
   out_3022064996999117402[97] = 0;
   out_3022064996999117402[98] = 0;
   out_3022064996999117402[99] = 0;
   out_3022064996999117402[100] = 0;
   out_3022064996999117402[101] = 0;
   out_3022064996999117402[102] = 0;
   out_3022064996999117402[103] = 0;
   out_3022064996999117402[104] = 0;
   out_3022064996999117402[105] = 0;
   out_3022064996999117402[106] = 0;
   out_3022064996999117402[107] = 0;
   out_3022064996999117402[108] = -0.5*state[6];
   out_3022064996999117402[109] = 0.5*state[3];
   out_3022064996999117402[110] = 0.5*state[4];
   out_3022064996999117402[111] = 0;
   out_3022064996999117402[112] = 0;
   out_3022064996999117402[113] = 0;
   out_3022064996999117402[114] = 0;
   out_3022064996999117402[115] = 0;
   out_3022064996999117402[116] = 0;
   out_3022064996999117402[117] = 0;
   out_3022064996999117402[118] = 0;
   out_3022064996999117402[119] = 0;
   out_3022064996999117402[120] = 0;
   out_3022064996999117402[121] = 0;
   out_3022064996999117402[122] = 0;
   out_3022064996999117402[123] = 0;
   out_3022064996999117402[124] = 0;
   out_3022064996999117402[125] = 0;
   out_3022064996999117402[126] = 0;
   out_3022064996999117402[127] = 0;
   out_3022064996999117402[128] = 0;
   out_3022064996999117402[129] = 0.5*state[5];
   out_3022064996999117402[130] = -0.5*state[4];
   out_3022064996999117402[131] = 0.5*state[3];
   out_3022064996999117402[132] = 0;
   out_3022064996999117402[133] = 0;
   out_3022064996999117402[134] = 0;
   out_3022064996999117402[135] = 0;
   out_3022064996999117402[136] = 0;
   out_3022064996999117402[137] = 0;
   out_3022064996999117402[138] = 0;
   out_3022064996999117402[139] = 0;
   out_3022064996999117402[140] = 0;
   out_3022064996999117402[141] = 0;
   out_3022064996999117402[142] = 0;
   out_3022064996999117402[143] = 0;
   out_3022064996999117402[144] = 0;
   out_3022064996999117402[145] = 0;
   out_3022064996999117402[146] = 0;
   out_3022064996999117402[147] = 0;
   out_3022064996999117402[148] = 0;
   out_3022064996999117402[149] = 0;
   out_3022064996999117402[150] = 0;
   out_3022064996999117402[151] = 0;
   out_3022064996999117402[152] = 0;
   out_3022064996999117402[153] = 1.0;
   out_3022064996999117402[154] = 0;
   out_3022064996999117402[155] = 0;
   out_3022064996999117402[156] = 0;
   out_3022064996999117402[157] = 0;
   out_3022064996999117402[158] = 0;
   out_3022064996999117402[159] = 0;
   out_3022064996999117402[160] = 0;
   out_3022064996999117402[161] = 0;
   out_3022064996999117402[162] = 0;
   out_3022064996999117402[163] = 0;
   out_3022064996999117402[164] = 0;
   out_3022064996999117402[165] = 0;
   out_3022064996999117402[166] = 0;
   out_3022064996999117402[167] = 0;
   out_3022064996999117402[168] = 0;
   out_3022064996999117402[169] = 0;
   out_3022064996999117402[170] = 0;
   out_3022064996999117402[171] = 0;
   out_3022064996999117402[172] = 0;
   out_3022064996999117402[173] = 0;
   out_3022064996999117402[174] = 0;
   out_3022064996999117402[175] = 1.0;
   out_3022064996999117402[176] = 0;
   out_3022064996999117402[177] = 0;
   out_3022064996999117402[178] = 0;
   out_3022064996999117402[179] = 0;
   out_3022064996999117402[180] = 0;
   out_3022064996999117402[181] = 0;
   out_3022064996999117402[182] = 0;
   out_3022064996999117402[183] = 0;
   out_3022064996999117402[184] = 0;
   out_3022064996999117402[185] = 0;
   out_3022064996999117402[186] = 0;
   out_3022064996999117402[187] = 0;
   out_3022064996999117402[188] = 0;
   out_3022064996999117402[189] = 0;
   out_3022064996999117402[190] = 0;
   out_3022064996999117402[191] = 0;
   out_3022064996999117402[192] = 0;
   out_3022064996999117402[193] = 0;
   out_3022064996999117402[194] = 0;
   out_3022064996999117402[195] = 0;
   out_3022064996999117402[196] = 0;
   out_3022064996999117402[197] = 1.0;
   out_3022064996999117402[198] = 0;
   out_3022064996999117402[199] = 0;
   out_3022064996999117402[200] = 0;
   out_3022064996999117402[201] = 0;
   out_3022064996999117402[202] = 0;
   out_3022064996999117402[203] = 0;
   out_3022064996999117402[204] = 0;
   out_3022064996999117402[205] = 0;
   out_3022064996999117402[206] = 0;
   out_3022064996999117402[207] = 0;
   out_3022064996999117402[208] = 0;
   out_3022064996999117402[209] = 0;
   out_3022064996999117402[210] = 0;
   out_3022064996999117402[211] = 0;
   out_3022064996999117402[212] = 0;
   out_3022064996999117402[213] = 0;
   out_3022064996999117402[214] = 0;
   out_3022064996999117402[215] = 0;
   out_3022064996999117402[216] = 0;
   out_3022064996999117402[217] = 0;
   out_3022064996999117402[218] = 0;
   out_3022064996999117402[219] = 1.0;
   out_3022064996999117402[220] = 0;
   out_3022064996999117402[221] = 0;
   out_3022064996999117402[222] = 0;
   out_3022064996999117402[223] = 0;
   out_3022064996999117402[224] = 0;
   out_3022064996999117402[225] = 0;
   out_3022064996999117402[226] = 0;
   out_3022064996999117402[227] = 0;
   out_3022064996999117402[228] = 0;
   out_3022064996999117402[229] = 0;
   out_3022064996999117402[230] = 0;
   out_3022064996999117402[231] = 0;
   out_3022064996999117402[232] = 0;
   out_3022064996999117402[233] = 0;
   out_3022064996999117402[234] = 0;
   out_3022064996999117402[235] = 0;
   out_3022064996999117402[236] = 0;
   out_3022064996999117402[237] = 0;
   out_3022064996999117402[238] = 0;
   out_3022064996999117402[239] = 0;
   out_3022064996999117402[240] = 0;
   out_3022064996999117402[241] = 1.0;
   out_3022064996999117402[242] = 0;
   out_3022064996999117402[243] = 0;
   out_3022064996999117402[244] = 0;
   out_3022064996999117402[245] = 0;
   out_3022064996999117402[246] = 0;
   out_3022064996999117402[247] = 0;
   out_3022064996999117402[248] = 0;
   out_3022064996999117402[249] = 0;
   out_3022064996999117402[250] = 0;
   out_3022064996999117402[251] = 0;
   out_3022064996999117402[252] = 0;
   out_3022064996999117402[253] = 0;
   out_3022064996999117402[254] = 0;
   out_3022064996999117402[255] = 0;
   out_3022064996999117402[256] = 0;
   out_3022064996999117402[257] = 0;
   out_3022064996999117402[258] = 0;
   out_3022064996999117402[259] = 0;
   out_3022064996999117402[260] = 0;
   out_3022064996999117402[261] = 0;
   out_3022064996999117402[262] = 0;
   out_3022064996999117402[263] = 1.0;
   out_3022064996999117402[264] = 0;
   out_3022064996999117402[265] = 0;
   out_3022064996999117402[266] = 0;
   out_3022064996999117402[267] = 0;
   out_3022064996999117402[268] = 0;
   out_3022064996999117402[269] = 0;
   out_3022064996999117402[270] = 0;
   out_3022064996999117402[271] = 0;
   out_3022064996999117402[272] = 0;
   out_3022064996999117402[273] = 0;
   out_3022064996999117402[274] = 0;
   out_3022064996999117402[275] = 0;
   out_3022064996999117402[276] = 0;
   out_3022064996999117402[277] = 0;
   out_3022064996999117402[278] = 0;
   out_3022064996999117402[279] = 0;
   out_3022064996999117402[280] = 0;
   out_3022064996999117402[281] = 0;
   out_3022064996999117402[282] = 0;
   out_3022064996999117402[283] = 0;
   out_3022064996999117402[284] = 0;
   out_3022064996999117402[285] = 1.0;
   out_3022064996999117402[286] = 0;
   out_3022064996999117402[287] = 0;
   out_3022064996999117402[288] = 0;
   out_3022064996999117402[289] = 0;
   out_3022064996999117402[290] = 0;
   out_3022064996999117402[291] = 0;
   out_3022064996999117402[292] = 0;
   out_3022064996999117402[293] = 0;
   out_3022064996999117402[294] = 0;
   out_3022064996999117402[295] = 0;
   out_3022064996999117402[296] = 0;
   out_3022064996999117402[297] = 0;
   out_3022064996999117402[298] = 0;
   out_3022064996999117402[299] = 0;
   out_3022064996999117402[300] = 0;
   out_3022064996999117402[301] = 0;
   out_3022064996999117402[302] = 0;
   out_3022064996999117402[303] = 0;
   out_3022064996999117402[304] = 0;
   out_3022064996999117402[305] = 0;
   out_3022064996999117402[306] = 0;
   out_3022064996999117402[307] = 1.0;
   out_3022064996999117402[308] = 0;
   out_3022064996999117402[309] = 0;
   out_3022064996999117402[310] = 0;
   out_3022064996999117402[311] = 0;
   out_3022064996999117402[312] = 0;
   out_3022064996999117402[313] = 0;
   out_3022064996999117402[314] = 0;
   out_3022064996999117402[315] = 0;
   out_3022064996999117402[316] = 0;
   out_3022064996999117402[317] = 0;
   out_3022064996999117402[318] = 0;
   out_3022064996999117402[319] = 0;
   out_3022064996999117402[320] = 0;
   out_3022064996999117402[321] = 0;
   out_3022064996999117402[322] = 0;
   out_3022064996999117402[323] = 0;
   out_3022064996999117402[324] = 0;
   out_3022064996999117402[325] = 0;
   out_3022064996999117402[326] = 0;
   out_3022064996999117402[327] = 0;
   out_3022064996999117402[328] = 0;
   out_3022064996999117402[329] = 1.0;
   out_3022064996999117402[330] = 0;
   out_3022064996999117402[331] = 0;
   out_3022064996999117402[332] = 0;
   out_3022064996999117402[333] = 0;
   out_3022064996999117402[334] = 0;
   out_3022064996999117402[335] = 0;
   out_3022064996999117402[336] = 0;
   out_3022064996999117402[337] = 0;
   out_3022064996999117402[338] = 0;
   out_3022064996999117402[339] = 0;
   out_3022064996999117402[340] = 0;
   out_3022064996999117402[341] = 0;
   out_3022064996999117402[342] = 0;
   out_3022064996999117402[343] = 0;
   out_3022064996999117402[344] = 0;
   out_3022064996999117402[345] = 0;
   out_3022064996999117402[346] = 0;
   out_3022064996999117402[347] = 0;
   out_3022064996999117402[348] = 0;
   out_3022064996999117402[349] = 0;
   out_3022064996999117402[350] = 0;
   out_3022064996999117402[351] = 1.0;
   out_3022064996999117402[352] = 0;
   out_3022064996999117402[353] = 0;
   out_3022064996999117402[354] = 0;
   out_3022064996999117402[355] = 0;
   out_3022064996999117402[356] = 0;
   out_3022064996999117402[357] = 0;
   out_3022064996999117402[358] = 0;
   out_3022064996999117402[359] = 0;
   out_3022064996999117402[360] = 0;
   out_3022064996999117402[361] = 0;
   out_3022064996999117402[362] = 0;
   out_3022064996999117402[363] = 0;
   out_3022064996999117402[364] = 0;
   out_3022064996999117402[365] = 0;
   out_3022064996999117402[366] = 0;
   out_3022064996999117402[367] = 0;
   out_3022064996999117402[368] = 0;
   out_3022064996999117402[369] = 0;
   out_3022064996999117402[370] = 0;
   out_3022064996999117402[371] = 0;
   out_3022064996999117402[372] = 0;
   out_3022064996999117402[373] = 1.0;
   out_3022064996999117402[374] = 0;
   out_3022064996999117402[375] = 0;
   out_3022064996999117402[376] = 0;
   out_3022064996999117402[377] = 0;
   out_3022064996999117402[378] = 0;
   out_3022064996999117402[379] = 0;
   out_3022064996999117402[380] = 0;
   out_3022064996999117402[381] = 0;
   out_3022064996999117402[382] = 0;
   out_3022064996999117402[383] = 0;
   out_3022064996999117402[384] = 0;
   out_3022064996999117402[385] = 0;
   out_3022064996999117402[386] = 0;
   out_3022064996999117402[387] = 0;
   out_3022064996999117402[388] = 0;
   out_3022064996999117402[389] = 0;
   out_3022064996999117402[390] = 0;
   out_3022064996999117402[391] = 0;
   out_3022064996999117402[392] = 0;
   out_3022064996999117402[393] = 0;
   out_3022064996999117402[394] = 0;
   out_3022064996999117402[395] = 1.0;
   out_3022064996999117402[396] = 0;
   out_3022064996999117402[397] = 0;
   out_3022064996999117402[398] = 0;
   out_3022064996999117402[399] = 0;
   out_3022064996999117402[400] = 0;
   out_3022064996999117402[401] = 0;
   out_3022064996999117402[402] = 0;
   out_3022064996999117402[403] = 0;
   out_3022064996999117402[404] = 0;
   out_3022064996999117402[405] = 0;
   out_3022064996999117402[406] = 0;
   out_3022064996999117402[407] = 0;
   out_3022064996999117402[408] = 0;
   out_3022064996999117402[409] = 0;
   out_3022064996999117402[410] = 0;
   out_3022064996999117402[411] = 0;
   out_3022064996999117402[412] = 0;
   out_3022064996999117402[413] = 0;
   out_3022064996999117402[414] = 0;
   out_3022064996999117402[415] = 0;
   out_3022064996999117402[416] = 0;
   out_3022064996999117402[417] = 1.0;
   out_3022064996999117402[418] = 0;
   out_3022064996999117402[419] = 0;
   out_3022064996999117402[420] = 0;
   out_3022064996999117402[421] = 0;
   out_3022064996999117402[422] = 0;
   out_3022064996999117402[423] = 0;
   out_3022064996999117402[424] = 0;
   out_3022064996999117402[425] = 0;
   out_3022064996999117402[426] = 0;
   out_3022064996999117402[427] = 0;
   out_3022064996999117402[428] = 0;
   out_3022064996999117402[429] = 0;
   out_3022064996999117402[430] = 0;
   out_3022064996999117402[431] = 0;
   out_3022064996999117402[432] = 0;
   out_3022064996999117402[433] = 0;
   out_3022064996999117402[434] = 0;
   out_3022064996999117402[435] = 0;
   out_3022064996999117402[436] = 0;
   out_3022064996999117402[437] = 0;
   out_3022064996999117402[438] = 0;
   out_3022064996999117402[439] = 1.0;
   out_3022064996999117402[440] = 0;
   out_3022064996999117402[441] = 0;
   out_3022064996999117402[442] = 0;
   out_3022064996999117402[443] = 0;
   out_3022064996999117402[444] = 0;
   out_3022064996999117402[445] = 0;
   out_3022064996999117402[446] = 0;
   out_3022064996999117402[447] = 0;
   out_3022064996999117402[448] = 0;
   out_3022064996999117402[449] = 0;
   out_3022064996999117402[450] = 0;
   out_3022064996999117402[451] = 0;
   out_3022064996999117402[452] = 0;
   out_3022064996999117402[453] = 0;
   out_3022064996999117402[454] = 0;
   out_3022064996999117402[455] = 0;
   out_3022064996999117402[456] = 0;
   out_3022064996999117402[457] = 0;
   out_3022064996999117402[458] = 0;
   out_3022064996999117402[459] = 0;
   out_3022064996999117402[460] = 0;
   out_3022064996999117402[461] = 1.0;
}
void f_fun(double *state, double dt, double *out_211128429486972418) {
   out_211128429486972418[0] = dt*state[7] + state[0];
   out_211128429486972418[1] = dt*state[8] + state[1];
   out_211128429486972418[2] = dt*state[9] + state[2];
   out_211128429486972418[3] = dt*(-0.5*state[4]*state[10] - 0.5*state[5]*state[11] - 0.5*state[6]*state[12]) + state[3];
   out_211128429486972418[4] = dt*(0.5*state[3]*state[10] + 0.5*state[5]*state[12] - 0.5*state[6]*state[11]) + state[4];
   out_211128429486972418[5] = dt*(0.5*state[3]*state[11] - 0.5*state[4]*state[12] + 0.5*state[6]*state[10]) + state[5];
   out_211128429486972418[6] = dt*(0.5*state[3]*state[12] + 0.5*state[4]*state[11] - 0.5*state[5]*state[10]) + state[6];
   out_211128429486972418[7] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[18] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[17] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[16]) + state[7];
   out_211128429486972418[8] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[18] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[16] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[17]) + state[8];
   out_211128429486972418[9] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[17] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]) + state[9];
   out_211128429486972418[10] = state[10];
   out_211128429486972418[11] = state[11];
   out_211128429486972418[12] = state[12];
   out_211128429486972418[13] = state[13];
   out_211128429486972418[14] = state[14];
   out_211128429486972418[15] = state[15];
   out_211128429486972418[16] = state[16];
   out_211128429486972418[17] = state[17];
   out_211128429486972418[18] = state[18];
   out_211128429486972418[19] = state[19];
   out_211128429486972418[20] = state[20];
   out_211128429486972418[21] = state[21];
}
void F_fun(double *state, double dt, double *out_7477901336729587113) {
   out_7477901336729587113[0] = 1;
   out_7477901336729587113[1] = 0;
   out_7477901336729587113[2] = 0;
   out_7477901336729587113[3] = 0;
   out_7477901336729587113[4] = 0;
   out_7477901336729587113[5] = 0;
   out_7477901336729587113[6] = dt;
   out_7477901336729587113[7] = 0;
   out_7477901336729587113[8] = 0;
   out_7477901336729587113[9] = 0;
   out_7477901336729587113[10] = 0;
   out_7477901336729587113[11] = 0;
   out_7477901336729587113[12] = 0;
   out_7477901336729587113[13] = 0;
   out_7477901336729587113[14] = 0;
   out_7477901336729587113[15] = 0;
   out_7477901336729587113[16] = 0;
   out_7477901336729587113[17] = 0;
   out_7477901336729587113[18] = 0;
   out_7477901336729587113[19] = 0;
   out_7477901336729587113[20] = 0;
   out_7477901336729587113[21] = 0;
   out_7477901336729587113[22] = 1;
   out_7477901336729587113[23] = 0;
   out_7477901336729587113[24] = 0;
   out_7477901336729587113[25] = 0;
   out_7477901336729587113[26] = 0;
   out_7477901336729587113[27] = 0;
   out_7477901336729587113[28] = dt;
   out_7477901336729587113[29] = 0;
   out_7477901336729587113[30] = 0;
   out_7477901336729587113[31] = 0;
   out_7477901336729587113[32] = 0;
   out_7477901336729587113[33] = 0;
   out_7477901336729587113[34] = 0;
   out_7477901336729587113[35] = 0;
   out_7477901336729587113[36] = 0;
   out_7477901336729587113[37] = 0;
   out_7477901336729587113[38] = 0;
   out_7477901336729587113[39] = 0;
   out_7477901336729587113[40] = 0;
   out_7477901336729587113[41] = 0;
   out_7477901336729587113[42] = 0;
   out_7477901336729587113[43] = 0;
   out_7477901336729587113[44] = 1;
   out_7477901336729587113[45] = 0;
   out_7477901336729587113[46] = 0;
   out_7477901336729587113[47] = 0;
   out_7477901336729587113[48] = 0;
   out_7477901336729587113[49] = 0;
   out_7477901336729587113[50] = dt;
   out_7477901336729587113[51] = 0;
   out_7477901336729587113[52] = 0;
   out_7477901336729587113[53] = 0;
   out_7477901336729587113[54] = 0;
   out_7477901336729587113[55] = 0;
   out_7477901336729587113[56] = 0;
   out_7477901336729587113[57] = 0;
   out_7477901336729587113[58] = 0;
   out_7477901336729587113[59] = 0;
   out_7477901336729587113[60] = 0;
   out_7477901336729587113[61] = 0;
   out_7477901336729587113[62] = 0;
   out_7477901336729587113[63] = 0;
   out_7477901336729587113[64] = 0;
   out_7477901336729587113[65] = 0;
   out_7477901336729587113[66] = 1;
   out_7477901336729587113[67] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[11] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[10] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[12]);
   out_7477901336729587113[68] = dt*((2*state[3]*state[4] - 2*state[5]*state[6])*state[12] + (-2*state[3]*state[6] - 2*state[4]*state[5])*state[10] + (-pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[11]);
   out_7477901336729587113[69] = 0;
   out_7477901336729587113[70] = 0;
   out_7477901336729587113[71] = 0;
   out_7477901336729587113[72] = dt*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2));
   out_7477901336729587113[73] = dt*(-2*state[3]*state[6] + 2*state[4]*state[5]);
   out_7477901336729587113[74] = dt*(2*state[3]*state[5] + 2*state[4]*state[6]);
   out_7477901336729587113[75] = 0;
   out_7477901336729587113[76] = 0;
   out_7477901336729587113[77] = 0;
   out_7477901336729587113[78] = 0;
   out_7477901336729587113[79] = 0;
   out_7477901336729587113[80] = 0;
   out_7477901336729587113[81] = 0;
   out_7477901336729587113[82] = 0;
   out_7477901336729587113[83] = 0;
   out_7477901336729587113[84] = 0;
   out_7477901336729587113[85] = 0;
   out_7477901336729587113[86] = 0;
   out_7477901336729587113[87] = dt*(-(2*state[3]*state[4] + 2*state[5]*state[6])*state[11] - (-2*state[3]*state[5] + 2*state[4]*state[6])*state[10] - (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[12]);
   out_7477901336729587113[88] = 1;
   out_7477901336729587113[89] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[12] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[11] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[10]);
   out_7477901336729587113[90] = 0;
   out_7477901336729587113[91] = 0;
   out_7477901336729587113[92] = 0;
   out_7477901336729587113[93] = dt*(2*state[3]*state[6] + 2*state[4]*state[5]);
   out_7477901336729587113[94] = dt*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2));
   out_7477901336729587113[95] = dt*(-2*state[3]*state[4] + 2*state[5]*state[6]);
   out_7477901336729587113[96] = 0;
   out_7477901336729587113[97] = 0;
   out_7477901336729587113[98] = 0;
   out_7477901336729587113[99] = 0;
   out_7477901336729587113[100] = 0;
   out_7477901336729587113[101] = 0;
   out_7477901336729587113[102] = 0;
   out_7477901336729587113[103] = 0;
   out_7477901336729587113[104] = 0;
   out_7477901336729587113[105] = 0;
   out_7477901336729587113[106] = 0;
   out_7477901336729587113[107] = 0;
   out_7477901336729587113[108] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[12] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[10] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[11]);
   out_7477901336729587113[109] = dt*((-2*state[3]*state[5] - 2*state[4]*state[6])*state[12] + (2*state[3]*state[6] - 2*state[4]*state[5])*state[11] + (-pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) + pow(state[6], 2))*state[10]);
   out_7477901336729587113[110] = 1;
   out_7477901336729587113[111] = 0;
   out_7477901336729587113[112] = 0;
   out_7477901336729587113[113] = 0;
   out_7477901336729587113[114] = dt*(-2*state[3]*state[5] + 2*state[4]*state[6]);
   out_7477901336729587113[115] = dt*(2*state[3]*state[4] + 2*state[5]*state[6]);
   out_7477901336729587113[116] = dt*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2));
   out_7477901336729587113[117] = 0;
   out_7477901336729587113[118] = 0;
   out_7477901336729587113[119] = 0;
   out_7477901336729587113[120] = 0;
   out_7477901336729587113[121] = 0;
   out_7477901336729587113[122] = 0;
   out_7477901336729587113[123] = 0;
   out_7477901336729587113[124] = 0;
   out_7477901336729587113[125] = 0;
   out_7477901336729587113[126] = 0;
   out_7477901336729587113[127] = 0;
   out_7477901336729587113[128] = 0;
   out_7477901336729587113[129] = 0;
   out_7477901336729587113[130] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[17] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]);
   out_7477901336729587113[131] = dt*((2*state[3]*state[4] - 2*state[5]*state[6])*state[18] + (-2*state[3]*state[6] - 2*state[4]*state[5])*state[16] + (-pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[17]);
   out_7477901336729587113[132] = 1;
   out_7477901336729587113[133] = 0;
   out_7477901336729587113[134] = 0;
   out_7477901336729587113[135] = 0;
   out_7477901336729587113[136] = 0;
   out_7477901336729587113[137] = 0;
   out_7477901336729587113[138] = 0;
   out_7477901336729587113[139] = 0;
   out_7477901336729587113[140] = 0;
   out_7477901336729587113[141] = dt*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2));
   out_7477901336729587113[142] = dt*(-2*state[3]*state[6] + 2*state[4]*state[5]);
   out_7477901336729587113[143] = dt*(2*state[3]*state[5] + 2*state[4]*state[6]);
   out_7477901336729587113[144] = 0;
   out_7477901336729587113[145] = 0;
   out_7477901336729587113[146] = 0;
   out_7477901336729587113[147] = 0;
   out_7477901336729587113[148] = 0;
   out_7477901336729587113[149] = 0;
   out_7477901336729587113[150] = dt*(-(2*state[3]*state[4] + 2*state[5]*state[6])*state[17] - (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] - (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]);
   out_7477901336729587113[151] = 0;
   out_7477901336729587113[152] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[18] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[17] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[16]);
   out_7477901336729587113[153] = 0;
   out_7477901336729587113[154] = 1;
   out_7477901336729587113[155] = 0;
   out_7477901336729587113[156] = 0;
   out_7477901336729587113[157] = 0;
   out_7477901336729587113[158] = 0;
   out_7477901336729587113[159] = 0;
   out_7477901336729587113[160] = 0;
   out_7477901336729587113[161] = 0;
   out_7477901336729587113[162] = dt*(2*state[3]*state[6] + 2*state[4]*state[5]);
   out_7477901336729587113[163] = dt*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2));
   out_7477901336729587113[164] = dt*(-2*state[3]*state[4] + 2*state[5]*state[6]);
   out_7477901336729587113[165] = 0;
   out_7477901336729587113[166] = 0;
   out_7477901336729587113[167] = 0;
   out_7477901336729587113[168] = 0;
   out_7477901336729587113[169] = 0;
   out_7477901336729587113[170] = 0;
   out_7477901336729587113[171] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[18] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[16] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[17]);
   out_7477901336729587113[172] = dt*((-2*state[3]*state[5] - 2*state[4]*state[6])*state[18] + (2*state[3]*state[6] - 2*state[4]*state[5])*state[17] + (-pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) + pow(state[6], 2))*state[16]);
   out_7477901336729587113[173] = 0;
   out_7477901336729587113[174] = 0;
   out_7477901336729587113[175] = 0;
   out_7477901336729587113[176] = 1;
   out_7477901336729587113[177] = 0;
   out_7477901336729587113[178] = 0;
   out_7477901336729587113[179] = 0;
   out_7477901336729587113[180] = 0;
   out_7477901336729587113[181] = 0;
   out_7477901336729587113[182] = 0;
   out_7477901336729587113[183] = dt*(-2*state[3]*state[5] + 2*state[4]*state[6]);
   out_7477901336729587113[184] = dt*(2*state[3]*state[4] + 2*state[5]*state[6]);
   out_7477901336729587113[185] = dt*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2));
   out_7477901336729587113[186] = 0;
   out_7477901336729587113[187] = 0;
   out_7477901336729587113[188] = 0;
   out_7477901336729587113[189] = 0;
   out_7477901336729587113[190] = 0;
   out_7477901336729587113[191] = 0;
   out_7477901336729587113[192] = 0;
   out_7477901336729587113[193] = 0;
   out_7477901336729587113[194] = 0;
   out_7477901336729587113[195] = 0;
   out_7477901336729587113[196] = 0;
   out_7477901336729587113[197] = 0;
   out_7477901336729587113[198] = 1;
   out_7477901336729587113[199] = 0;
   out_7477901336729587113[200] = 0;
   out_7477901336729587113[201] = 0;
   out_7477901336729587113[202] = 0;
   out_7477901336729587113[203] = 0;
   out_7477901336729587113[204] = 0;
   out_7477901336729587113[205] = 0;
   out_7477901336729587113[206] = 0;
   out_7477901336729587113[207] = 0;
   out_7477901336729587113[208] = 0;
   out_7477901336729587113[209] = 0;
   out_7477901336729587113[210] = 0;
   out_7477901336729587113[211] = 0;
   out_7477901336729587113[212] = 0;
   out_7477901336729587113[213] = 0;
   out_7477901336729587113[214] = 0;
   out_7477901336729587113[215] = 0;
   out_7477901336729587113[216] = 0;
   out_7477901336729587113[217] = 0;
   out_7477901336729587113[218] = 0;
   out_7477901336729587113[219] = 0;
   out_7477901336729587113[220] = 1;
   out_7477901336729587113[221] = 0;
   out_7477901336729587113[222] = 0;
   out_7477901336729587113[223] = 0;
   out_7477901336729587113[224] = 0;
   out_7477901336729587113[225] = 0;
   out_7477901336729587113[226] = 0;
   out_7477901336729587113[227] = 0;
   out_7477901336729587113[228] = 0;
   out_7477901336729587113[229] = 0;
   out_7477901336729587113[230] = 0;
   out_7477901336729587113[231] = 0;
   out_7477901336729587113[232] = 0;
   out_7477901336729587113[233] = 0;
   out_7477901336729587113[234] = 0;
   out_7477901336729587113[235] = 0;
   out_7477901336729587113[236] = 0;
   out_7477901336729587113[237] = 0;
   out_7477901336729587113[238] = 0;
   out_7477901336729587113[239] = 0;
   out_7477901336729587113[240] = 0;
   out_7477901336729587113[241] = 0;
   out_7477901336729587113[242] = 1;
   out_7477901336729587113[243] = 0;
   out_7477901336729587113[244] = 0;
   out_7477901336729587113[245] = 0;
   out_7477901336729587113[246] = 0;
   out_7477901336729587113[247] = 0;
   out_7477901336729587113[248] = 0;
   out_7477901336729587113[249] = 0;
   out_7477901336729587113[250] = 0;
   out_7477901336729587113[251] = 0;
   out_7477901336729587113[252] = 0;
   out_7477901336729587113[253] = 0;
   out_7477901336729587113[254] = 0;
   out_7477901336729587113[255] = 0;
   out_7477901336729587113[256] = 0;
   out_7477901336729587113[257] = 0;
   out_7477901336729587113[258] = 0;
   out_7477901336729587113[259] = 0;
   out_7477901336729587113[260] = 0;
   out_7477901336729587113[261] = 0;
   out_7477901336729587113[262] = 0;
   out_7477901336729587113[263] = 0;
   out_7477901336729587113[264] = 1;
   out_7477901336729587113[265] = 0;
   out_7477901336729587113[266] = 0;
   out_7477901336729587113[267] = 0;
   out_7477901336729587113[268] = 0;
   out_7477901336729587113[269] = 0;
   out_7477901336729587113[270] = 0;
   out_7477901336729587113[271] = 0;
   out_7477901336729587113[272] = 0;
   out_7477901336729587113[273] = 0;
   out_7477901336729587113[274] = 0;
   out_7477901336729587113[275] = 0;
   out_7477901336729587113[276] = 0;
   out_7477901336729587113[277] = 0;
   out_7477901336729587113[278] = 0;
   out_7477901336729587113[279] = 0;
   out_7477901336729587113[280] = 0;
   out_7477901336729587113[281] = 0;
   out_7477901336729587113[282] = 0;
   out_7477901336729587113[283] = 0;
   out_7477901336729587113[284] = 0;
   out_7477901336729587113[285] = 0;
   out_7477901336729587113[286] = 1;
   out_7477901336729587113[287] = 0;
   out_7477901336729587113[288] = 0;
   out_7477901336729587113[289] = 0;
   out_7477901336729587113[290] = 0;
   out_7477901336729587113[291] = 0;
   out_7477901336729587113[292] = 0;
   out_7477901336729587113[293] = 0;
   out_7477901336729587113[294] = 0;
   out_7477901336729587113[295] = 0;
   out_7477901336729587113[296] = 0;
   out_7477901336729587113[297] = 0;
   out_7477901336729587113[298] = 0;
   out_7477901336729587113[299] = 0;
   out_7477901336729587113[300] = 0;
   out_7477901336729587113[301] = 0;
   out_7477901336729587113[302] = 0;
   out_7477901336729587113[303] = 0;
   out_7477901336729587113[304] = 0;
   out_7477901336729587113[305] = 0;
   out_7477901336729587113[306] = 0;
   out_7477901336729587113[307] = 0;
   out_7477901336729587113[308] = 1;
   out_7477901336729587113[309] = 0;
   out_7477901336729587113[310] = 0;
   out_7477901336729587113[311] = 0;
   out_7477901336729587113[312] = 0;
   out_7477901336729587113[313] = 0;
   out_7477901336729587113[314] = 0;
   out_7477901336729587113[315] = 0;
   out_7477901336729587113[316] = 0;
   out_7477901336729587113[317] = 0;
   out_7477901336729587113[318] = 0;
   out_7477901336729587113[319] = 0;
   out_7477901336729587113[320] = 0;
   out_7477901336729587113[321] = 0;
   out_7477901336729587113[322] = 0;
   out_7477901336729587113[323] = 0;
   out_7477901336729587113[324] = 0;
   out_7477901336729587113[325] = 0;
   out_7477901336729587113[326] = 0;
   out_7477901336729587113[327] = 0;
   out_7477901336729587113[328] = 0;
   out_7477901336729587113[329] = 0;
   out_7477901336729587113[330] = 1;
   out_7477901336729587113[331] = 0;
   out_7477901336729587113[332] = 0;
   out_7477901336729587113[333] = 0;
   out_7477901336729587113[334] = 0;
   out_7477901336729587113[335] = 0;
   out_7477901336729587113[336] = 0;
   out_7477901336729587113[337] = 0;
   out_7477901336729587113[338] = 0;
   out_7477901336729587113[339] = 0;
   out_7477901336729587113[340] = 0;
   out_7477901336729587113[341] = 0;
   out_7477901336729587113[342] = 0;
   out_7477901336729587113[343] = 0;
   out_7477901336729587113[344] = 0;
   out_7477901336729587113[345] = 0;
   out_7477901336729587113[346] = 0;
   out_7477901336729587113[347] = 0;
   out_7477901336729587113[348] = 0;
   out_7477901336729587113[349] = 0;
   out_7477901336729587113[350] = 0;
   out_7477901336729587113[351] = 0;
   out_7477901336729587113[352] = 1;
   out_7477901336729587113[353] = 0;
   out_7477901336729587113[354] = 0;
   out_7477901336729587113[355] = 0;
   out_7477901336729587113[356] = 0;
   out_7477901336729587113[357] = 0;
   out_7477901336729587113[358] = 0;
   out_7477901336729587113[359] = 0;
   out_7477901336729587113[360] = 0;
   out_7477901336729587113[361] = 0;
   out_7477901336729587113[362] = 0;
   out_7477901336729587113[363] = 0;
   out_7477901336729587113[364] = 0;
   out_7477901336729587113[365] = 0;
   out_7477901336729587113[366] = 0;
   out_7477901336729587113[367] = 0;
   out_7477901336729587113[368] = 0;
   out_7477901336729587113[369] = 0;
   out_7477901336729587113[370] = 0;
   out_7477901336729587113[371] = 0;
   out_7477901336729587113[372] = 0;
   out_7477901336729587113[373] = 0;
   out_7477901336729587113[374] = 1;
   out_7477901336729587113[375] = 0;
   out_7477901336729587113[376] = 0;
   out_7477901336729587113[377] = 0;
   out_7477901336729587113[378] = 0;
   out_7477901336729587113[379] = 0;
   out_7477901336729587113[380] = 0;
   out_7477901336729587113[381] = 0;
   out_7477901336729587113[382] = 0;
   out_7477901336729587113[383] = 0;
   out_7477901336729587113[384] = 0;
   out_7477901336729587113[385] = 0;
   out_7477901336729587113[386] = 0;
   out_7477901336729587113[387] = 0;
   out_7477901336729587113[388] = 0;
   out_7477901336729587113[389] = 0;
   out_7477901336729587113[390] = 0;
   out_7477901336729587113[391] = 0;
   out_7477901336729587113[392] = 0;
   out_7477901336729587113[393] = 0;
   out_7477901336729587113[394] = 0;
   out_7477901336729587113[395] = 0;
   out_7477901336729587113[396] = 1;
   out_7477901336729587113[397] = 0;
   out_7477901336729587113[398] = 0;
   out_7477901336729587113[399] = 0;
   out_7477901336729587113[400] = 0;
   out_7477901336729587113[401] = 0;
   out_7477901336729587113[402] = 0;
   out_7477901336729587113[403] = 0;
   out_7477901336729587113[404] = 0;
   out_7477901336729587113[405] = 0;
   out_7477901336729587113[406] = 0;
   out_7477901336729587113[407] = 0;
   out_7477901336729587113[408] = 0;
   out_7477901336729587113[409] = 0;
   out_7477901336729587113[410] = 0;
   out_7477901336729587113[411] = 0;
   out_7477901336729587113[412] = 0;
   out_7477901336729587113[413] = 0;
   out_7477901336729587113[414] = 0;
   out_7477901336729587113[415] = 0;
   out_7477901336729587113[416] = 0;
   out_7477901336729587113[417] = 0;
   out_7477901336729587113[418] = 1;
   out_7477901336729587113[419] = 0;
   out_7477901336729587113[420] = 0;
   out_7477901336729587113[421] = 0;
   out_7477901336729587113[422] = 0;
   out_7477901336729587113[423] = 0;
   out_7477901336729587113[424] = 0;
   out_7477901336729587113[425] = 0;
   out_7477901336729587113[426] = 0;
   out_7477901336729587113[427] = 0;
   out_7477901336729587113[428] = 0;
   out_7477901336729587113[429] = 0;
   out_7477901336729587113[430] = 0;
   out_7477901336729587113[431] = 0;
   out_7477901336729587113[432] = 0;
   out_7477901336729587113[433] = 0;
   out_7477901336729587113[434] = 0;
   out_7477901336729587113[435] = 0;
   out_7477901336729587113[436] = 0;
   out_7477901336729587113[437] = 0;
   out_7477901336729587113[438] = 0;
   out_7477901336729587113[439] = 0;
   out_7477901336729587113[440] = 1;
}
void h_4(double *state, double *unused, double *out_1416724246099778923) {
   out_1416724246099778923[0] = state[10] + state[13];
   out_1416724246099778923[1] = state[11] + state[14];
   out_1416724246099778923[2] = state[12] + state[15];
}
void H_4(double *state, double *unused, double *out_640460847784457531) {
   out_640460847784457531[0] = 0;
   out_640460847784457531[1] = 0;
   out_640460847784457531[2] = 0;
   out_640460847784457531[3] = 0;
   out_640460847784457531[4] = 0;
   out_640460847784457531[5] = 0;
   out_640460847784457531[6] = 0;
   out_640460847784457531[7] = 0;
   out_640460847784457531[8] = 0;
   out_640460847784457531[9] = 0;
   out_640460847784457531[10] = 1;
   out_640460847784457531[11] = 0;
   out_640460847784457531[12] = 0;
   out_640460847784457531[13] = 1;
   out_640460847784457531[14] = 0;
   out_640460847784457531[15] = 0;
   out_640460847784457531[16] = 0;
   out_640460847784457531[17] = 0;
   out_640460847784457531[18] = 0;
   out_640460847784457531[19] = 0;
   out_640460847784457531[20] = 0;
   out_640460847784457531[21] = 0;
   out_640460847784457531[22] = 0;
   out_640460847784457531[23] = 0;
   out_640460847784457531[24] = 0;
   out_640460847784457531[25] = 0;
   out_640460847784457531[26] = 0;
   out_640460847784457531[27] = 0;
   out_640460847784457531[28] = 0;
   out_640460847784457531[29] = 0;
   out_640460847784457531[30] = 0;
   out_640460847784457531[31] = 0;
   out_640460847784457531[32] = 0;
   out_640460847784457531[33] = 1;
   out_640460847784457531[34] = 0;
   out_640460847784457531[35] = 0;
   out_640460847784457531[36] = 1;
   out_640460847784457531[37] = 0;
   out_640460847784457531[38] = 0;
   out_640460847784457531[39] = 0;
   out_640460847784457531[40] = 0;
   out_640460847784457531[41] = 0;
   out_640460847784457531[42] = 0;
   out_640460847784457531[43] = 0;
   out_640460847784457531[44] = 0;
   out_640460847784457531[45] = 0;
   out_640460847784457531[46] = 0;
   out_640460847784457531[47] = 0;
   out_640460847784457531[48] = 0;
   out_640460847784457531[49] = 0;
   out_640460847784457531[50] = 0;
   out_640460847784457531[51] = 0;
   out_640460847784457531[52] = 0;
   out_640460847784457531[53] = 0;
   out_640460847784457531[54] = 0;
   out_640460847784457531[55] = 0;
   out_640460847784457531[56] = 1;
   out_640460847784457531[57] = 0;
   out_640460847784457531[58] = 0;
   out_640460847784457531[59] = 1;
   out_640460847784457531[60] = 0;
   out_640460847784457531[61] = 0;
   out_640460847784457531[62] = 0;
   out_640460847784457531[63] = 0;
   out_640460847784457531[64] = 0;
   out_640460847784457531[65] = 0;
}
void h_9(double *state, double *unused, double *out_5267497251750324843) {
   out_5267497251750324843[0] = state[10];
   out_5267497251750324843[1] = state[11];
   out_5267497251750324843[2] = state[12];
}
void H_9(double *state, double *unused, double *out_399271201154866886) {
   out_399271201154866886[0] = 0;
   out_399271201154866886[1] = 0;
   out_399271201154866886[2] = 0;
   out_399271201154866886[3] = 0;
   out_399271201154866886[4] = 0;
   out_399271201154866886[5] = 0;
   out_399271201154866886[6] = 0;
   out_399271201154866886[7] = 0;
   out_399271201154866886[8] = 0;
   out_399271201154866886[9] = 0;
   out_399271201154866886[10] = 1;
   out_399271201154866886[11] = 0;
   out_399271201154866886[12] = 0;
   out_399271201154866886[13] = 0;
   out_399271201154866886[14] = 0;
   out_399271201154866886[15] = 0;
   out_399271201154866886[16] = 0;
   out_399271201154866886[17] = 0;
   out_399271201154866886[18] = 0;
   out_399271201154866886[19] = 0;
   out_399271201154866886[20] = 0;
   out_399271201154866886[21] = 0;
   out_399271201154866886[22] = 0;
   out_399271201154866886[23] = 0;
   out_399271201154866886[24] = 0;
   out_399271201154866886[25] = 0;
   out_399271201154866886[26] = 0;
   out_399271201154866886[27] = 0;
   out_399271201154866886[28] = 0;
   out_399271201154866886[29] = 0;
   out_399271201154866886[30] = 0;
   out_399271201154866886[31] = 0;
   out_399271201154866886[32] = 0;
   out_399271201154866886[33] = 1;
   out_399271201154866886[34] = 0;
   out_399271201154866886[35] = 0;
   out_399271201154866886[36] = 0;
   out_399271201154866886[37] = 0;
   out_399271201154866886[38] = 0;
   out_399271201154866886[39] = 0;
   out_399271201154866886[40] = 0;
   out_399271201154866886[41] = 0;
   out_399271201154866886[42] = 0;
   out_399271201154866886[43] = 0;
   out_399271201154866886[44] = 0;
   out_399271201154866886[45] = 0;
   out_399271201154866886[46] = 0;
   out_399271201154866886[47] = 0;
   out_399271201154866886[48] = 0;
   out_399271201154866886[49] = 0;
   out_399271201154866886[50] = 0;
   out_399271201154866886[51] = 0;
   out_399271201154866886[52] = 0;
   out_399271201154866886[53] = 0;
   out_399271201154866886[54] = 0;
   out_399271201154866886[55] = 0;
   out_399271201154866886[56] = 1;
   out_399271201154866886[57] = 0;
   out_399271201154866886[58] = 0;
   out_399271201154866886[59] = 0;
   out_399271201154866886[60] = 0;
   out_399271201154866886[61] = 0;
   out_399271201154866886[62] = 0;
   out_399271201154866886[63] = 0;
   out_399271201154866886[64] = 0;
   out_399271201154866886[65] = 0;
}
void h_10(double *state, double *unused, double *out_2133571045890165454) {
   out_2133571045890165454[0] = 398600500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2] + 398600500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0] + state[16] + state[19];
   out_2133571045890165454[1] = 398600500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2] + 398600500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[1] + state[17] + state[20];
   out_2133571045890165454[2] = 398600500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1] + 398600500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[2] + state[18] + state[21];
}
void H_10(double *state, double *unused, double *out_6608212112768862026) {
   out_6608212112768862026[0] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*pow(state[0], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2));
   out_6608212112768862026[1] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[1], 2) + 398600500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0]*state[1];
   out_6608212112768862026[2] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[2], 2) + 398600500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0]*state[2];
   out_6608212112768862026[3] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5];
   out_6608212112768862026[4] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6];
   out_6608212112768862026[5] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3];
   out_6608212112768862026[6] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4];
   out_6608212112768862026[7] = 0;
   out_6608212112768862026[8] = 0;
   out_6608212112768862026[9] = 0;
   out_6608212112768862026[10] = 0;
   out_6608212112768862026[11] = 0;
   out_6608212112768862026[12] = 0;
   out_6608212112768862026[13] = 0;
   out_6608212112768862026[14] = 0;
   out_6608212112768862026[15] = 0;
   out_6608212112768862026[16] = 1;
   out_6608212112768862026[17] = 0;
   out_6608212112768862026[18] = 0;
   out_6608212112768862026[19] = 1;
   out_6608212112768862026[20] = 0;
   out_6608212112768862026[21] = 0;
   out_6608212112768862026[22] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[0], 2) + 398600500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[0]*state[1];
   out_6608212112768862026[23] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*pow(state[1], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2));
   out_6608212112768862026[24] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[2], 2) + 398600500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[1]*state[2];
   out_6608212112768862026[25] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4];
   out_6608212112768862026[26] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3];
   out_6608212112768862026[27] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6];
   out_6608212112768862026[28] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5];
   out_6608212112768862026[29] = 0;
   out_6608212112768862026[30] = 0;
   out_6608212112768862026[31] = 0;
   out_6608212112768862026[32] = 0;
   out_6608212112768862026[33] = 0;
   out_6608212112768862026[34] = 0;
   out_6608212112768862026[35] = 0;
   out_6608212112768862026[36] = 0;
   out_6608212112768862026[37] = 0;
   out_6608212112768862026[38] = 0;
   out_6608212112768862026[39] = 1;
   out_6608212112768862026[40] = 0;
   out_6608212112768862026[41] = 0;
   out_6608212112768862026[42] = 1;
   out_6608212112768862026[43] = 0;
   out_6608212112768862026[44] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[0], 2) + 398600500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[0]*state[2];
   out_6608212112768862026[45] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[1], 2) + 398600500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[1]*state[2];
   out_6608212112768862026[46] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*pow(state[2], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2));
   out_6608212112768862026[47] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3];
   out_6608212112768862026[48] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4];
   out_6608212112768862026[49] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5];
   out_6608212112768862026[50] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6];
   out_6608212112768862026[51] = 0;
   out_6608212112768862026[52] = 0;
   out_6608212112768862026[53] = 0;
   out_6608212112768862026[54] = 0;
   out_6608212112768862026[55] = 0;
   out_6608212112768862026[56] = 0;
   out_6608212112768862026[57] = 0;
   out_6608212112768862026[58] = 0;
   out_6608212112768862026[59] = 0;
   out_6608212112768862026[60] = 0;
   out_6608212112768862026[61] = 0;
   out_6608212112768862026[62] = 1;
   out_6608212112768862026[63] = 0;
   out_6608212112768862026[64] = 0;
   out_6608212112768862026[65] = 1;
}
void h_12(double *state, double *unused, double *out_2579549306557761547) {
   out_2579549306557761547[0] = state[0];
   out_2579549306557761547[1] = state[1];
   out_2579549306557761547[2] = state[2];
}
void H_12(double *state, double *unused, double *out_19361822736863864) {
   out_19361822736863864[0] = 1;
   out_19361822736863864[1] = 0;
   out_19361822736863864[2] = 0;
   out_19361822736863864[3] = 0;
   out_19361822736863864[4] = 0;
   out_19361822736863864[5] = 0;
   out_19361822736863864[6] = 0;
   out_19361822736863864[7] = 0;
   out_19361822736863864[8] = 0;
   out_19361822736863864[9] = 0;
   out_19361822736863864[10] = 0;
   out_19361822736863864[11] = 0;
   out_19361822736863864[12] = 0;
   out_19361822736863864[13] = 0;
   out_19361822736863864[14] = 0;
   out_19361822736863864[15] = 0;
   out_19361822736863864[16] = 0;
   out_19361822736863864[17] = 0;
   out_19361822736863864[18] = 0;
   out_19361822736863864[19] = 0;
   out_19361822736863864[20] = 0;
   out_19361822736863864[21] = 0;
   out_19361822736863864[22] = 0;
   out_19361822736863864[23] = 1;
   out_19361822736863864[24] = 0;
   out_19361822736863864[25] = 0;
   out_19361822736863864[26] = 0;
   out_19361822736863864[27] = 0;
   out_19361822736863864[28] = 0;
   out_19361822736863864[29] = 0;
   out_19361822736863864[30] = 0;
   out_19361822736863864[31] = 0;
   out_19361822736863864[32] = 0;
   out_19361822736863864[33] = 0;
   out_19361822736863864[34] = 0;
   out_19361822736863864[35] = 0;
   out_19361822736863864[36] = 0;
   out_19361822736863864[37] = 0;
   out_19361822736863864[38] = 0;
   out_19361822736863864[39] = 0;
   out_19361822736863864[40] = 0;
   out_19361822736863864[41] = 0;
   out_19361822736863864[42] = 0;
   out_19361822736863864[43] = 0;
   out_19361822736863864[44] = 0;
   out_19361822736863864[45] = 0;
   out_19361822736863864[46] = 1;
   out_19361822736863864[47] = 0;
   out_19361822736863864[48] = 0;
   out_19361822736863864[49] = 0;
   out_19361822736863864[50] = 0;
   out_19361822736863864[51] = 0;
   out_19361822736863864[52] = 0;
   out_19361822736863864[53] = 0;
   out_19361822736863864[54] = 0;
   out_19361822736863864[55] = 0;
   out_19361822736863864[56] = 0;
   out_19361822736863864[57] = 0;
   out_19361822736863864[58] = 0;
   out_19361822736863864[59] = 0;
   out_19361822736863864[60] = 0;
   out_19361822736863864[61] = 0;
   out_19361822736863864[62] = 0;
   out_19361822736863864[63] = 0;
   out_19361822736863864[64] = 0;
   out_19361822736863864[65] = 0;
}
void h_35(double *state, double *unused, double *out_5125780411757793974) {
   out_5125780411757793974[0] = state[7];
   out_5125780411757793974[1] = state[8];
   out_5125780411757793974[2] = state[9];
}
void H_35(double *state, double *unused, double *out_2726201209588149845) {
   out_2726201209588149845[0] = 0;
   out_2726201209588149845[1] = 0;
   out_2726201209588149845[2] = 0;
   out_2726201209588149845[3] = 0;
   out_2726201209588149845[4] = 0;
   out_2726201209588149845[5] = 0;
   out_2726201209588149845[6] = 0;
   out_2726201209588149845[7] = 1;
   out_2726201209588149845[8] = 0;
   out_2726201209588149845[9] = 0;
   out_2726201209588149845[10] = 0;
   out_2726201209588149845[11] = 0;
   out_2726201209588149845[12] = 0;
   out_2726201209588149845[13] = 0;
   out_2726201209588149845[14] = 0;
   out_2726201209588149845[15] = 0;
   out_2726201209588149845[16] = 0;
   out_2726201209588149845[17] = 0;
   out_2726201209588149845[18] = 0;
   out_2726201209588149845[19] = 0;
   out_2726201209588149845[20] = 0;
   out_2726201209588149845[21] = 0;
   out_2726201209588149845[22] = 0;
   out_2726201209588149845[23] = 0;
   out_2726201209588149845[24] = 0;
   out_2726201209588149845[25] = 0;
   out_2726201209588149845[26] = 0;
   out_2726201209588149845[27] = 0;
   out_2726201209588149845[28] = 0;
   out_2726201209588149845[29] = 0;
   out_2726201209588149845[30] = 1;
   out_2726201209588149845[31] = 0;
   out_2726201209588149845[32] = 0;
   out_2726201209588149845[33] = 0;
   out_2726201209588149845[34] = 0;
   out_2726201209588149845[35] = 0;
   out_2726201209588149845[36] = 0;
   out_2726201209588149845[37] = 0;
   out_2726201209588149845[38] = 0;
   out_2726201209588149845[39] = 0;
   out_2726201209588149845[40] = 0;
   out_2726201209588149845[41] = 0;
   out_2726201209588149845[42] = 0;
   out_2726201209588149845[43] = 0;
   out_2726201209588149845[44] = 0;
   out_2726201209588149845[45] = 0;
   out_2726201209588149845[46] = 0;
   out_2726201209588149845[47] = 0;
   out_2726201209588149845[48] = 0;
   out_2726201209588149845[49] = 0;
   out_2726201209588149845[50] = 0;
   out_2726201209588149845[51] = 0;
   out_2726201209588149845[52] = 0;
   out_2726201209588149845[53] = 1;
   out_2726201209588149845[54] = 0;
   out_2726201209588149845[55] = 0;
   out_2726201209588149845[56] = 0;
   out_2726201209588149845[57] = 0;
   out_2726201209588149845[58] = 0;
   out_2726201209588149845[59] = 0;
   out_2726201209588149845[60] = 0;
   out_2726201209588149845[61] = 0;
   out_2726201209588149845[62] = 0;
   out_2726201209588149845[63] = 0;
   out_2726201209588149845[64] = 0;
   out_2726201209588149845[65] = 0;
}
void h_32(double *state, double *unused, double *out_7940142825117524696) {
   out_7940142825117524696[0] = state[3];
   out_7940142825117524696[1] = state[4];
   out_7940142825117524696[2] = state[5];
   out_7940142825117524696[3] = state[6];
}
void H_32(double *state, double *unused, double *out_1614803566144957043) {
   out_1614803566144957043[0] = 0;
   out_1614803566144957043[1] = 0;
   out_1614803566144957043[2] = 0;
   out_1614803566144957043[3] = 1;
   out_1614803566144957043[4] = 0;
   out_1614803566144957043[5] = 0;
   out_1614803566144957043[6] = 0;
   out_1614803566144957043[7] = 0;
   out_1614803566144957043[8] = 0;
   out_1614803566144957043[9] = 0;
   out_1614803566144957043[10] = 0;
   out_1614803566144957043[11] = 0;
   out_1614803566144957043[12] = 0;
   out_1614803566144957043[13] = 0;
   out_1614803566144957043[14] = 0;
   out_1614803566144957043[15] = 0;
   out_1614803566144957043[16] = 0;
   out_1614803566144957043[17] = 0;
   out_1614803566144957043[18] = 0;
   out_1614803566144957043[19] = 0;
   out_1614803566144957043[20] = 0;
   out_1614803566144957043[21] = 0;
   out_1614803566144957043[22] = 0;
   out_1614803566144957043[23] = 0;
   out_1614803566144957043[24] = 0;
   out_1614803566144957043[25] = 0;
   out_1614803566144957043[26] = 1;
   out_1614803566144957043[27] = 0;
   out_1614803566144957043[28] = 0;
   out_1614803566144957043[29] = 0;
   out_1614803566144957043[30] = 0;
   out_1614803566144957043[31] = 0;
   out_1614803566144957043[32] = 0;
   out_1614803566144957043[33] = 0;
   out_1614803566144957043[34] = 0;
   out_1614803566144957043[35] = 0;
   out_1614803566144957043[36] = 0;
   out_1614803566144957043[37] = 0;
   out_1614803566144957043[38] = 0;
   out_1614803566144957043[39] = 0;
   out_1614803566144957043[40] = 0;
   out_1614803566144957043[41] = 0;
   out_1614803566144957043[42] = 0;
   out_1614803566144957043[43] = 0;
   out_1614803566144957043[44] = 0;
   out_1614803566144957043[45] = 0;
   out_1614803566144957043[46] = 0;
   out_1614803566144957043[47] = 0;
   out_1614803566144957043[48] = 0;
   out_1614803566144957043[49] = 1;
   out_1614803566144957043[50] = 0;
   out_1614803566144957043[51] = 0;
   out_1614803566144957043[52] = 0;
   out_1614803566144957043[53] = 0;
   out_1614803566144957043[54] = 0;
   out_1614803566144957043[55] = 0;
   out_1614803566144957043[56] = 0;
   out_1614803566144957043[57] = 0;
   out_1614803566144957043[58] = 0;
   out_1614803566144957043[59] = 0;
   out_1614803566144957043[60] = 0;
   out_1614803566144957043[61] = 0;
   out_1614803566144957043[62] = 0;
   out_1614803566144957043[63] = 0;
   out_1614803566144957043[64] = 0;
   out_1614803566144957043[65] = 0;
   out_1614803566144957043[66] = 0;
   out_1614803566144957043[67] = 0;
   out_1614803566144957043[68] = 0;
   out_1614803566144957043[69] = 0;
   out_1614803566144957043[70] = 0;
   out_1614803566144957043[71] = 0;
   out_1614803566144957043[72] = 1;
   out_1614803566144957043[73] = 0;
   out_1614803566144957043[74] = 0;
   out_1614803566144957043[75] = 0;
   out_1614803566144957043[76] = 0;
   out_1614803566144957043[77] = 0;
   out_1614803566144957043[78] = 0;
   out_1614803566144957043[79] = 0;
   out_1614803566144957043[80] = 0;
   out_1614803566144957043[81] = 0;
   out_1614803566144957043[82] = 0;
   out_1614803566144957043[83] = 0;
   out_1614803566144957043[84] = 0;
   out_1614803566144957043[85] = 0;
   out_1614803566144957043[86] = 0;
   out_1614803566144957043[87] = 0;
}
void h_13(double *state, double *unused, double *out_453097342475321776) {
   out_453097342475321776[0] = (-2*state[3]*state[5] + 2*state[4]*state[6])*state[9] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[8] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[7];
   out_453097342475321776[1] = (2*state[3]*state[4] + 2*state[5]*state[6])*state[9] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[7] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[8];
   out_453097342475321776[2] = (-2*state[3]*state[4] + 2*state[5]*state[6])*state[8] + (2*state[3]*state[5] + 2*state[4]*state[6])*state[7] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[9];
}
void H_13(double *state, double *unused, double *out_1585131618163734730) {
   out_1585131618163734730[0] = 0;
   out_1585131618163734730[1] = 0;
   out_1585131618163734730[2] = 0;
   out_1585131618163734730[3] = 2*state[3]*state[7] - 2*state[5]*state[9] + 2*state[6]*state[8];
   out_1585131618163734730[4] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9];
   out_1585131618163734730[5] = -2*state[3]*state[9] + 2*state[4]*state[8] - 2*state[5]*state[7];
   out_1585131618163734730[6] = 2*state[3]*state[8] + 2*state[4]*state[9] - 2*state[6]*state[7];
   out_1585131618163734730[7] = pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2);
   out_1585131618163734730[8] = 2*state[3]*state[6] + 2*state[4]*state[5];
   out_1585131618163734730[9] = -2*state[3]*state[5] + 2*state[4]*state[6];
   out_1585131618163734730[10] = 0;
   out_1585131618163734730[11] = 0;
   out_1585131618163734730[12] = 0;
   out_1585131618163734730[13] = 0;
   out_1585131618163734730[14] = 0;
   out_1585131618163734730[15] = 0;
   out_1585131618163734730[16] = 0;
   out_1585131618163734730[17] = 0;
   out_1585131618163734730[18] = 0;
   out_1585131618163734730[19] = 0;
   out_1585131618163734730[20] = 0;
   out_1585131618163734730[21] = 0;
   out_1585131618163734730[22] = 0;
   out_1585131618163734730[23] = 0;
   out_1585131618163734730[24] = 0;
   out_1585131618163734730[25] = 2*state[3]*state[8] + 2*state[4]*state[9] - 2*state[6]*state[7];
   out_1585131618163734730[26] = 2*state[3]*state[9] - 2*state[4]*state[8] + 2*state[5]*state[7];
   out_1585131618163734730[27] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9];
   out_1585131618163734730[28] = -2*state[3]*state[7] + 2*state[5]*state[9] - 2*state[6]*state[8];
   out_1585131618163734730[29] = -2*state[3]*state[6] + 2*state[4]*state[5];
   out_1585131618163734730[30] = pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2);
   out_1585131618163734730[31] = 2*state[3]*state[4] + 2*state[5]*state[6];
   out_1585131618163734730[32] = 0;
   out_1585131618163734730[33] = 0;
   out_1585131618163734730[34] = 0;
   out_1585131618163734730[35] = 0;
   out_1585131618163734730[36] = 0;
   out_1585131618163734730[37] = 0;
   out_1585131618163734730[38] = 0;
   out_1585131618163734730[39] = 0;
   out_1585131618163734730[40] = 0;
   out_1585131618163734730[41] = 0;
   out_1585131618163734730[42] = 0;
   out_1585131618163734730[43] = 0;
   out_1585131618163734730[44] = 0;
   out_1585131618163734730[45] = 0;
   out_1585131618163734730[46] = 0;
   out_1585131618163734730[47] = 2*state[3]*state[9] - 2*state[4]*state[8] + 2*state[5]*state[7];
   out_1585131618163734730[48] = -2*state[3]*state[8] - 2*state[4]*state[9] + 2*state[6]*state[7];
   out_1585131618163734730[49] = 2*state[3]*state[7] - 2*state[5]*state[9] + 2*state[6]*state[8];
   out_1585131618163734730[50] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9];
   out_1585131618163734730[51] = 2*state[3]*state[5] + 2*state[4]*state[6];
   out_1585131618163734730[52] = -2*state[3]*state[4] + 2*state[5]*state[6];
   out_1585131618163734730[53] = pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2);
   out_1585131618163734730[54] = 0;
   out_1585131618163734730[55] = 0;
   out_1585131618163734730[56] = 0;
   out_1585131618163734730[57] = 0;
   out_1585131618163734730[58] = 0;
   out_1585131618163734730[59] = 0;
   out_1585131618163734730[60] = 0;
   out_1585131618163734730[61] = 0;
   out_1585131618163734730[62] = 0;
   out_1585131618163734730[63] = 0;
   out_1585131618163734730[64] = 0;
   out_1585131618163734730[65] = 0;
}
void h_14(double *state, double *unused, double *out_5267497251750324843) {
   out_5267497251750324843[0] = state[10];
   out_5267497251750324843[1] = state[11];
   out_5267497251750324843[2] = state[12];
}
void H_14(double *state, double *unused, double *out_399271201154866886) {
   out_399271201154866886[0] = 0;
   out_399271201154866886[1] = 0;
   out_399271201154866886[2] = 0;
   out_399271201154866886[3] = 0;
   out_399271201154866886[4] = 0;
   out_399271201154866886[5] = 0;
   out_399271201154866886[6] = 0;
   out_399271201154866886[7] = 0;
   out_399271201154866886[8] = 0;
   out_399271201154866886[9] = 0;
   out_399271201154866886[10] = 1;
   out_399271201154866886[11] = 0;
   out_399271201154866886[12] = 0;
   out_399271201154866886[13] = 0;
   out_399271201154866886[14] = 0;
   out_399271201154866886[15] = 0;
   out_399271201154866886[16] = 0;
   out_399271201154866886[17] = 0;
   out_399271201154866886[18] = 0;
   out_399271201154866886[19] = 0;
   out_399271201154866886[20] = 0;
   out_399271201154866886[21] = 0;
   out_399271201154866886[22] = 0;
   out_399271201154866886[23] = 0;
   out_399271201154866886[24] = 0;
   out_399271201154866886[25] = 0;
   out_399271201154866886[26] = 0;
   out_399271201154866886[27] = 0;
   out_399271201154866886[28] = 0;
   out_399271201154866886[29] = 0;
   out_399271201154866886[30] = 0;
   out_399271201154866886[31] = 0;
   out_399271201154866886[32] = 0;
   out_399271201154866886[33] = 1;
   out_399271201154866886[34] = 0;
   out_399271201154866886[35] = 0;
   out_399271201154866886[36] = 0;
   out_399271201154866886[37] = 0;
   out_399271201154866886[38] = 0;
   out_399271201154866886[39] = 0;
   out_399271201154866886[40] = 0;
   out_399271201154866886[41] = 0;
   out_399271201154866886[42] = 0;
   out_399271201154866886[43] = 0;
   out_399271201154866886[44] = 0;
   out_399271201154866886[45] = 0;
   out_399271201154866886[46] = 0;
   out_399271201154866886[47] = 0;
   out_399271201154866886[48] = 0;
   out_399271201154866886[49] = 0;
   out_399271201154866886[50] = 0;
   out_399271201154866886[51] = 0;
   out_399271201154866886[52] = 0;
   out_399271201154866886[53] = 0;
   out_399271201154866886[54] = 0;
   out_399271201154866886[55] = 0;
   out_399271201154866886[56] = 1;
   out_399271201154866886[57] = 0;
   out_399271201154866886[58] = 0;
   out_399271201154866886[59] = 0;
   out_399271201154866886[60] = 0;
   out_399271201154866886[61] = 0;
   out_399271201154866886[62] = 0;
   out_399271201154866886[63] = 0;
   out_399271201154866886[64] = 0;
   out_399271201154866886[65] = 0;
}
void h_33(double *state, double *unused, double *out_2148794914329694256) {
   out_2148794914329694256[0] = state[16];
   out_2148794914329694256[1] = state[17];
   out_2148794914329694256[2] = state[18];
}
void H_33(double *state, double *unused, double *out_5876758214227007449) {
   out_5876758214227007449[0] = 0;
   out_5876758214227007449[1] = 0;
   out_5876758214227007449[2] = 0;
   out_5876758214227007449[3] = 0;
   out_5876758214227007449[4] = 0;
   out_5876758214227007449[5] = 0;
   out_5876758214227007449[6] = 0;
   out_5876758214227007449[7] = 0;
   out_5876758214227007449[8] = 0;
   out_5876758214227007449[9] = 0;
   out_5876758214227007449[10] = 0;
   out_5876758214227007449[11] = 0;
   out_5876758214227007449[12] = 0;
   out_5876758214227007449[13] = 0;
   out_5876758214227007449[14] = 0;
   out_5876758214227007449[15] = 0;
   out_5876758214227007449[16] = 1;
   out_5876758214227007449[17] = 0;
   out_5876758214227007449[18] = 0;
   out_5876758214227007449[19] = 0;
   out_5876758214227007449[20] = 0;
   out_5876758214227007449[21] = 0;
   out_5876758214227007449[22] = 0;
   out_5876758214227007449[23] = 0;
   out_5876758214227007449[24] = 0;
   out_5876758214227007449[25] = 0;
   out_5876758214227007449[26] = 0;
   out_5876758214227007449[27] = 0;
   out_5876758214227007449[28] = 0;
   out_5876758214227007449[29] = 0;
   out_5876758214227007449[30] = 0;
   out_5876758214227007449[31] = 0;
   out_5876758214227007449[32] = 0;
   out_5876758214227007449[33] = 0;
   out_5876758214227007449[34] = 0;
   out_5876758214227007449[35] = 0;
   out_5876758214227007449[36] = 0;
   out_5876758214227007449[37] = 0;
   out_5876758214227007449[38] = 0;
   out_5876758214227007449[39] = 1;
   out_5876758214227007449[40] = 0;
   out_5876758214227007449[41] = 0;
   out_5876758214227007449[42] = 0;
   out_5876758214227007449[43] = 0;
   out_5876758214227007449[44] = 0;
   out_5876758214227007449[45] = 0;
   out_5876758214227007449[46] = 0;
   out_5876758214227007449[47] = 0;
   out_5876758214227007449[48] = 0;
   out_5876758214227007449[49] = 0;
   out_5876758214227007449[50] = 0;
   out_5876758214227007449[51] = 0;
   out_5876758214227007449[52] = 0;
   out_5876758214227007449[53] = 0;
   out_5876758214227007449[54] = 0;
   out_5876758214227007449[55] = 0;
   out_5876758214227007449[56] = 0;
   out_5876758214227007449[57] = 0;
   out_5876758214227007449[58] = 0;
   out_5876758214227007449[59] = 0;
   out_5876758214227007449[60] = 0;
   out_5876758214227007449[61] = 0;
   out_5876758214227007449[62] = 1;
   out_5876758214227007449[63] = 0;
   out_5876758214227007449[64] = 0;
   out_5876758214227007449[65] = 0;
}
#include <eigen3/Eigen/Dense>
#include <iostream>

typedef Eigen::Matrix<double, DIM, DIM, Eigen::RowMajor> DDM;
typedef Eigen::Matrix<double, EDIM, EDIM, Eigen::RowMajor> EEM;
typedef Eigen::Matrix<double, DIM, EDIM, Eigen::RowMajor> DEM;

void predict(double *in_x, double *in_P, double *in_Q, double dt) {
  typedef Eigen::Matrix<double, MEDIM, MEDIM, Eigen::RowMajor> RRM;

  double nx[DIM] = {0};
  double in_F[EDIM*EDIM] = {0};

  // functions from sympy
  f_fun(in_x, dt, nx);
  F_fun(in_x, dt, in_F);


  EEM F(in_F);
  EEM P(in_P);
  EEM Q(in_Q);

  RRM F_main = F.topLeftCorner(MEDIM, MEDIM);
  P.topLeftCorner(MEDIM, MEDIM) = (F_main * P.topLeftCorner(MEDIM, MEDIM)) * F_main.transpose();
  P.topRightCorner(MEDIM, EDIM - MEDIM) = F_main * P.topRightCorner(MEDIM, EDIM - MEDIM);
  P.bottomLeftCorner(EDIM - MEDIM, MEDIM) = P.bottomLeftCorner(EDIM - MEDIM, MEDIM) * F_main.transpose();

  P = P + dt*Q;

  // copy out state
  memcpy(in_x, nx, DIM * sizeof(double));
  memcpy(in_P, P.data(), EDIM * EDIM * sizeof(double));
}

// note: extra_args dim only correct when null space projecting
// otherwise 1
template <int ZDIM, int EADIM, bool MAHA_TEST>
void update(double *in_x, double *in_P, Hfun h_fun, Hfun H_fun, Hfun Hea_fun, double *in_z, double *in_R, double *in_ea, double MAHA_THRESHOLD) {
  typedef Eigen::Matrix<double, ZDIM, ZDIM, Eigen::RowMajor> ZZM;
  typedef Eigen::Matrix<double, ZDIM, DIM, Eigen::RowMajor> ZDM;
  typedef Eigen::Matrix<double, Eigen::Dynamic, EDIM, Eigen::RowMajor> XEM;
  //typedef Eigen::Matrix<double, EDIM, ZDIM, Eigen::RowMajor> EZM;
  typedef Eigen::Matrix<double, Eigen::Dynamic, 1> X1M;
  typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> XXM;

  double in_hx[ZDIM] = {0};
  double in_H[ZDIM * DIM] = {0};
  double in_H_mod[EDIM * DIM] = {0};
  double delta_x[EDIM] = {0};
  double x_new[DIM] = {0};


  // state x, P
  Eigen::Matrix<double, ZDIM, 1> z(in_z);
  EEM P(in_P);
  ZZM pre_R(in_R);

  // functions from sympy
  h_fun(in_x, in_ea, in_hx);
  H_fun(in_x, in_ea, in_H);
  ZDM pre_H(in_H);

  // get y (y = z - hx)
  Eigen::Matrix<double, ZDIM, 1> pre_y(in_hx); pre_y = z - pre_y;
  X1M y; XXM H; XXM R;
  if (Hea_fun){
    typedef Eigen::Matrix<double, ZDIM, EADIM, Eigen::RowMajor> ZAM;
    double in_Hea[ZDIM * EADIM] = {0};
    Hea_fun(in_x, in_ea, in_Hea);
    ZAM Hea(in_Hea);
    XXM A = Hea.transpose().fullPivLu().kernel();


    y = A.transpose() * pre_y;
    H = A.transpose() * pre_H;
    R = A.transpose() * pre_R * A;
  } else {
    y = pre_y;
    H = pre_H;
    R = pre_R;
  }
  // get modified H
  H_mod_fun(in_x, in_H_mod);
  DEM H_mod(in_H_mod);
  XEM H_err = H * H_mod;

  // Do mahalobis distance test
  if (MAHA_TEST){
    XXM a = (H_err * P * H_err.transpose() + R).inverse();
    double maha_dist = y.transpose() * a * y;
    if (maha_dist > MAHA_THRESHOLD){
      R = 1.0e16 * R;
    }
  }

  // Outlier resilient weighting
  double weight = 1;//(1.5)/(1 + y.squaredNorm()/R.sum());

  // kalman gains and I_KH
  XXM S = ((H_err * P) * H_err.transpose()) + R/weight;
  XEM KT = S.fullPivLu().solve(H_err * P.transpose());
  //EZM K = KT.transpose(); TODO: WHY DOES THIS NOT COMPILE?
  //EZM K = S.fullPivLu().solve(H_err * P.transpose()).transpose();
  //std::cout << "Here is the matrix rot:\n" << K << std::endl;
  EEM I_KH = Eigen::Matrix<double, EDIM, EDIM>::Identity() - (KT.transpose() * H_err);

  // update state by injecting dx
  Eigen::Matrix<double, EDIM, 1> dx(delta_x);
  dx  = (KT.transpose() * y);
  memcpy(delta_x, dx.data(), EDIM * sizeof(double));
  err_fun(in_x, delta_x, x_new);
  Eigen::Matrix<double, DIM, 1> x(x_new);

  // update cov
  P = ((I_KH * P) * I_KH.transpose()) + ((KT.transpose() * R) * KT);

  // copy out state
  memcpy(in_x, x.data(), DIM * sizeof(double));
  memcpy(in_P, P.data(), EDIM * EDIM * sizeof(double));
  memcpy(in_z, y.data(), y.rows() * sizeof(double));
}




}
extern "C" {

void live_update_4(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_4, H_4, NULL, in_z, in_R, in_ea, MAHA_THRESH_4);
}
void live_update_9(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_9, H_9, NULL, in_z, in_R, in_ea, MAHA_THRESH_9);
}
void live_update_10(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_10, H_10, NULL, in_z, in_R, in_ea, MAHA_THRESH_10);
}
void live_update_12(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_12, H_12, NULL, in_z, in_R, in_ea, MAHA_THRESH_12);
}
void live_update_35(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_35, H_35, NULL, in_z, in_R, in_ea, MAHA_THRESH_35);
}
void live_update_32(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<4, 3, 0>(in_x, in_P, h_32, H_32, NULL, in_z, in_R, in_ea, MAHA_THRESH_32);
}
void live_update_13(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_13, H_13, NULL, in_z, in_R, in_ea, MAHA_THRESH_13);
}
void live_update_14(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_14, H_14, NULL, in_z, in_R, in_ea, MAHA_THRESH_14);
}
void live_update_33(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_33, H_33, NULL, in_z, in_R, in_ea, MAHA_THRESH_33);
}
void live_H(double *in_vec, double *out_7176771882123068031) {
  H(in_vec, out_7176771882123068031);
}
void live_err_fun(double *nom_x, double *delta_x, double *out_7383003451745682886) {
  err_fun(nom_x, delta_x, out_7383003451745682886);
}
void live_inv_err_fun(double *nom_x, double *true_x, double *out_8043250382326694273) {
  inv_err_fun(nom_x, true_x, out_8043250382326694273);
}
void live_H_mod_fun(double *state, double *out_3022064996999117402) {
  H_mod_fun(state, out_3022064996999117402);
}
void live_f_fun(double *state, double dt, double *out_211128429486972418) {
  f_fun(state,  dt, out_211128429486972418);
}
void live_F_fun(double *state, double dt, double *out_7477901336729587113) {
  F_fun(state,  dt, out_7477901336729587113);
}
void live_h_4(double *state, double *unused, double *out_1416724246099778923) {
  h_4(state, unused, out_1416724246099778923);
}
void live_H_4(double *state, double *unused, double *out_640460847784457531) {
  H_4(state, unused, out_640460847784457531);
}
void live_h_9(double *state, double *unused, double *out_5267497251750324843) {
  h_9(state, unused, out_5267497251750324843);
}
void live_H_9(double *state, double *unused, double *out_399271201154866886) {
  H_9(state, unused, out_399271201154866886);
}
void live_h_10(double *state, double *unused, double *out_2133571045890165454) {
  h_10(state, unused, out_2133571045890165454);
}
void live_H_10(double *state, double *unused, double *out_6608212112768862026) {
  H_10(state, unused, out_6608212112768862026);
}
void live_h_12(double *state, double *unused, double *out_2579549306557761547) {
  h_12(state, unused, out_2579549306557761547);
}
void live_H_12(double *state, double *unused, double *out_19361822736863864) {
  H_12(state, unused, out_19361822736863864);
}
void live_h_35(double *state, double *unused, double *out_5125780411757793974) {
  h_35(state, unused, out_5125780411757793974);
}
void live_H_35(double *state, double *unused, double *out_2726201209588149845) {
  H_35(state, unused, out_2726201209588149845);
}
void live_h_32(double *state, double *unused, double *out_7940142825117524696) {
  h_32(state, unused, out_7940142825117524696);
}
void live_H_32(double *state, double *unused, double *out_1614803566144957043) {
  H_32(state, unused, out_1614803566144957043);
}
void live_h_13(double *state, double *unused, double *out_453097342475321776) {
  h_13(state, unused, out_453097342475321776);
}
void live_H_13(double *state, double *unused, double *out_1585131618163734730) {
  H_13(state, unused, out_1585131618163734730);
}
void live_h_14(double *state, double *unused, double *out_5267497251750324843) {
  h_14(state, unused, out_5267497251750324843);
}
void live_H_14(double *state, double *unused, double *out_399271201154866886) {
  H_14(state, unused, out_399271201154866886);
}
void live_h_33(double *state, double *unused, double *out_2148794914329694256) {
  h_33(state, unused, out_2148794914329694256);
}
void live_H_33(double *state, double *unused, double *out_5876758214227007449) {
  H_33(state, unused, out_5876758214227007449);
}
void live_predict(double *in_x, double *in_P, double *in_Q, double dt) {
  predict(in_x, in_P, in_Q, dt);
}
}

const EKF live = {
  .name = "live",
  .kinds = { 4, 9, 10, 12, 35, 32, 13, 14, 33 },
  .feature_kinds = {  },
  .f_fun = live_f_fun,
  .F_fun = live_F_fun,
  .err_fun = live_err_fun,
  .inv_err_fun = live_inv_err_fun,
  .H_mod_fun = live_H_mod_fun,
  .predict = live_predict,
  .hs = {
    { 4, live_h_4 },
    { 9, live_h_9 },
    { 10, live_h_10 },
    { 12, live_h_12 },
    { 35, live_h_35 },
    { 32, live_h_32 },
    { 13, live_h_13 },
    { 14, live_h_14 },
    { 33, live_h_33 },
  },
  .Hs = {
    { 4, live_H_4 },
    { 9, live_H_9 },
    { 10, live_H_10 },
    { 12, live_H_12 },
    { 35, live_H_35 },
    { 32, live_H_32 },
    { 13, live_H_13 },
    { 14, live_H_14 },
    { 33, live_H_33 },
  },
  .updates = {
    { 4, live_update_4 },
    { 9, live_update_9 },
    { 10, live_update_10 },
    { 12, live_update_12 },
    { 35, live_update_35 },
    { 32, live_update_32 },
    { 13, live_update_13 },
    { 14, live_update_14 },
    { 33, live_update_33 },
  },
  .Hes = {
  },
  .sets = {
  },
  .extra_routines = {
    { "H", live_H },
  },
};

ekf_lib_init(live)
